<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>3200：表达式</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">表达式</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">表达式</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                表达式                </h1>
                <p>时间限制：2s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：128MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><div align="left"><span style="font-size: medium">Tar的第一项家庭作业是一大堆中缀表达式。他要把这些表达式写成后缀形式之后交给老师。Tar不会做这个作业，所以他找同学要了一份答案来抄。Tar的老师是一个近视眼，分不清连续一串的相同字符和一个字符的区别。Tar今天感觉非常累，于是他决定偷懒，少抄几个字糊弄一下老师。请你帮他完成这个任务。</span></div>
<div align="left"><span style="font-size: medium">我们来做几个必要的定义。</span></div>
<div align="left"><span style="font-size: medium"><b>表达式</b>由a-z的小写字母和一些二元运算符构成，运算符可以是a-z以外的任意可见字符。</span></div>
<div align="left"><span style="font-size: medium"><b>中缀表达式</b>就是一般情况下使用的表达式，比如((a+h)/b)*(c+d)，将运算符置于两个运算数中间（注意运算数本身可以是变量或者一个表达式，因此这是一个递归定义）。一般可以利用括号指定运算顺序。</span></div>
<div align="left"><span style="font-size: medium"><b>后缀表达式</b>的特点是把运算符置于两个运算数之后，比如和上式等价的后缀表达式是ah+b/cd+*。后缀表达式不需要括号，严格从左到右进行计算。</span></div>
<div align="left"><span style="font-size: medium">另外我们假定这个表达式系统内，<b>相同的运算符号</b>满足结合律和交换律，具体来说：</span></div>
<div align="left"><span style="font-size: medium"><b>结合律</b>：A*(B*C) = (A*B)*C 写成后缀时，ABC** = AB*C*。</span></div>
<div align="left"><span style="font-size: medium"><b>交换律</b>：A*B = B*A 写成后缀时，AB* = BA*</span></div></p><hr/><h3>输入格式</h3><p><div align="left"><span style="font-size: medium">一行字符，表示Tar同学的答案。以后缀表达式的形式给出。</span></div></p><hr/><h3>输出格式</h3><p><div align="left"><span style="font-size: medium">输出一个数字，表示Tar能够蒙混过关至少要写几个字。</span></div></p><hr/><h3>样例输入</h3><pre>样例输入1
af+b*cd**

样例输入2
xy*x*y*x*y*</pre><hr/><h3>样例输出</h3><pre>样例输出1
7

样例输出2
3</pre><hr/><h3>提示</h3><p><p><span style="font-size: medium">样例解释2<br />
xy*x*y*x*y* = xxxyyy***** = (xy*) 长度为3 <br />
100%的数据满足：输入长度&lt;=2500</span></p></p><hr/><h3>题目来源</h3><p>没有写明来源</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=3200" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=3200" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>